const userDao = require('../dao/userDao');
//新增
module.exports.insert = async function (user) {
    return await userDao.insert(user);
}
//查询所有
module.exports.find = async function (page,searchParams) {
    return await userDao.find(page,searchParams);
}
//按id查询
module.exports.findById = async function (id) {
    return await userDao.findById(id);
}

//删除
module.exports.delete=async function(id){
    return await userDao.delete({_id:id});//删除一个
}

//修改
module.exports.update=async function(user){
    return await userDao.update(user);
}


module.exports.findByUsernameAndPassword = async function (user) {
    return await userDao.findByUsernameAndPassword(user);
}

//查询 导出
module.exports.findByUsernameAndPassWord = async function (user) {
    return await userDao.findByUsernameAndPassWord(user);
}

module.exports.findByUsername = async function (username) {
    return await userDao.findByUsername(username);
}